import Vue from "vue";
import VueRouter from "vue-router";
//创建路由组件
import Home from '@/views/Home';
import User from '@/views/User';
import Main from '@/views/Main';
import Mail from '@/views/Mail';
import PageOne from '@/views/PageOne';
import PageTwo from '@/views/PageTwo';
import Login from '@/views/Login'


Vue.use(VueRouter);


//路由和组件映射
const routes = [
    //主路由
    {
        
    path:'/',
    component:Main,
    name:'Main',
    redirect:'/home',//路径为/重定向到home
    children:[
        /*
        {path:'home',name:'home',component:Home},
        {path:'user',name:'user',component:User},
        {path:'mail',name:'mail',component:Mail},
        {path:'page1',name:'page1',component:PageOne},
        {path:'page2',name:'page2',component:PageTwo}
        */



    ]
},
{
        path:'/login',
        name:'login',
        component:Login
}
   

]
//创建router实例
const router = new VueRouter({
    routes
})
//暴露router实例
export default router
//将router实例挂载到main.js中